package fr.n7.khome.view.renderer;
/* 
 * ColorRenderer.java (compiles with releases 1.2, 1.3, and 1.4) is used by 
 * TableDialogEditDemo.java.
 */

import javax.swing.JTable;
import javax.swing.border.Border;
import javax.swing.table.TableCellRenderer;

import fr.n7.khome.core.Fuzzy;
import fr.n7.khome.view.JFuzzy;

import java.awt.Color;
import java.awt.Component;

public class FuzzyRenderer extends JFuzzy implements TableCellRenderer {
	
	private static final long serialVersionUID = -2773757204723149106L;
	Border unselectedBorder = null;
	Border selectedBorder = null;

	public FuzzyRenderer() {
		super(false);
//		setOpaque(true); //MUST do this for background to show up.
		setEnabled(true);
//		setHorizontalAlignment(JLabel.CENTER);
		addMouseListener(this);
	}

	public Component getTableCellRendererComponent(
			JTable table, Object o,
			boolean isSelected, boolean hasFocus,
			int row, int column) {
		if(o != null){
			if(o instanceof Fuzzy) {
				Fuzzy f = (Fuzzy)o;
				setFuzzy(f, false);
//				setText((f).toString());
//				setToolTipText("");
				setBackground(Color.WHITE);
			}
		}
		return this;
	}
}
